package com.guigu.controller;

import com.guigu.dto.grzxDTO;
import com.guigu.exception.SsmException;
import com.guigu.service.grzxService;
import com.guigu.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("grzx")
public class grzxController {
    @Autowired
    private grzxService grzxservice;

    @PostMapping("/update")
    public Result update(@RequestBody grzxDTO gg){
        try{
            System.out.println(gg);
            int a=this.grzxservice.updataacc(gg);
            int b=this.grzxservice.updatauser(gg);
            System.err.println(a);
            System.err.println(b);
            if(a*b!=0){
                return new Result<>("200", "true", "修改成功", null);
            }else{
                return new Result<>("400", "false", "修改失败", null);
            }
        }catch (Exception e){
            e.printStackTrace();
            throw  new SsmException("异常");
        }
    }
}
